package com.abaaba.project2.controller.wxcontroller;

import com.abaaba.project2.bean.vo.BaseRespVo;
import com.abaaba.project2.bean.vo.wx.WxClearHistoryVO;
import com.abaaba.project2.bean.vo.wx.WxHelperVO;
import com.abaaba.project2.service.wx.WxSearchModuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Map;
import java.util.regex.Pattern;

/**
 * @Author Hedgehog
 * @Date 2021/6/8 16:10
 * @Version 1.0
 */

@RestController
@RequestMapping("/wx/search")
public class WxSearchModuleController {

    @Autowired
    WxSearchModuleService wxSearchModuleService;

    @RequestMapping("/helper")
    public BaseRespVo wxSearchHelper(String keyword){
        //wxSearchModuleService.setHistory(keyword);
        //进行搜索
        WxHelperVO wxHelperVO = wxSearchModuleService.helper(keyword);

        return BaseRespVo.ok(wxHelperVO);
    }

    @RequestMapping("/clearhistory")
    public BaseRespVo wxClearHistory(@RequestBody Map map){
        //TODO
        //进不来，vo做什么的
        wxSearchModuleService.clearHistory();
        //System.out.println(111);
        return BaseRespVo.ok();
    }

}
